3.434 \(\int \cos ^2(c+d x) (a+b \tan ^2(c+d x)) \, dx\)

Optimal. Leaf size=33 \[ \frac {(a-b) \sin (c+d x) \cos (c+d x)}{2 d}+\frac {1}{2} x (a+b) \]

[Out]

1/2*(a+b)*x+1/2*(a-b)*cos(d*x+c)*sin(d*x+c)/d

________________________________________________________________________________________

Rubi [A]  time = 0.04, antiderivative size = 33, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3675, 385, 203} \[ \frac {(a-b) \sin (c+d x) \cos (c+d x)}{2 d}+\frac {1}{2} x (a+b) \]

Antiderivative was successfully verified.

[In]

Int[Cos[c + d*x]^2*(a + b*Tan[c + d*x]^2),x]

[Out]

((a + b)*x)/2 + ((a - b)*Cos[c + d*x]*Sin[c + d*x])/(2*d)

Rule 203

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTan[(Rt[b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 385

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> -Simp[((b*c - a*d)*x*(a + b*x^n)^(p +
 1))/(a*b*n*(p + 1)), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(a*b*n*(p + 1)), Int[(a + b*x^n)^(p + 1), x], x] /
; FreeQ[{a, b, c, d, n, p}, x] && NeQ[b*c - a*d, 0] && (LtQ[p, -1] || ILtQ[1/n + p, 0])

Rule 3675

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*((c_.)*tan[(e_.) + (f_.)*(x_)])^(n_))^(p_.), x_Symbol] :> With[
{ff = FreeFactors[Tan[e + f*x], x]}, Dist[ff/(c^(m - 1)*f), Subst[Int[(c^2 + ff^2*x^2)^(m/2 - 1)*(a + b*(ff*x)
^n)^p, x], x, (c*Tan[e + f*x])/ff], x]] /; FreeQ[{a, b, c, e, f, n, p}, x] && IntegerQ[m/2] && (IntegersQ[n, p
] || IGtQ[m, 0] || IGtQ[p, 0] || EqQ[n^2, 4] || EqQ[n^2, 16])

Rubi steps

\begin {align*} \int \cos ^2(c+d x) \left (a+b \tan ^2(c+d x)\right ) \, dx &=\frac {\operatorname {Subst}\left (\int \frac {a+b x^2}{\left (1+x^2\right )^2} \, dx,x,\tan (c+d x)\right )}{d}\\ &=\frac {(a-b) \cos (c+d x) \sin (c+d x)}{2 d}+\frac {(a+b) \operatorname {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (c+d x)\right )}{2 d}\\ &=\frac {1}{2} (a+b) x+\frac {(a-b) \cos (c+d x) \sin (c+d x)}{2 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.06, size = 32, normalized size = 0.97 \[ \frac {2 (a+b) (c+d x)+(a-b) \sin (2 (c+d x))}{4 d} \]

Antiderivative was successfully verified.

[In]

Integrate[Cos[c + d*x]^2*(a + b*Tan[c + d*x]^2),x]

[Out]

(2*(a + b)*(c + d*x) + (a - b)*Sin[2*(c + d*x)])/(4*d)

________________________________________________________________________________________

fricas [A]  time = 0.51, size = 30, normalized size = 0.91 \[ \frac {{\left (a + b\right )} d x + {\left (a - b\right )} \cos \left (d x + c\right ) \sin \left (d x + c\right )}{2 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*tan(d*x+c)^2),x, algorithm="fricas")

[Out]

1/2*((a + b)*d*x + (a - b)*cos(d*x + c)*sin(d*x + c))/d

________________________________________________________________________________________

giac [B]  time = 1.50, size = 169, normalized size = 5.12 \[ \frac {a d x \tan \left (d x\right )^{2} \tan \relax (c)^{2} + b d x \tan \left (d x\right )^{2} \tan \relax (c)^{2} + a d x \tan \left (d x\right )^{2} + b d x \tan \left (d x\right )^{2} + a d x \tan \relax (c)^{2} + b d x \tan \relax (c)^{2} - a \tan \left (d x\right )^{2} \tan \relax (c) + b \tan \left (d x\right )^{2} \tan \relax (c) - a \tan \left (d x\right ) \tan \relax (c)^{2} + b \tan \left (d x\right ) \tan \relax (c)^{2} + a d x + b d x + a \tan \left (d x\right ) - b \tan \left (d x\right ) + a \tan \relax (c) - b \tan \relax (c)}{2 \, {\left (d \tan \left (d x\right )^{2} \tan \relax (c)^{2} + d \tan \left (d x\right )^{2} + d \tan \relax (c)^{2} + d\right )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*tan(d*x+c)^2),x, algorithm="giac")

[Out]

1/2*(a*d*x*tan(d*x)^2*tan(c)^2 + b*d*x*tan(d*x)^2*tan(c)^2 + a*d*x*tan(d*x)^2 + b*d*x*tan(d*x)^2 + a*d*x*tan(c
)^2 + b*d*x*tan(c)^2 - a*tan(d*x)^2*tan(c) + b*tan(d*x)^2*tan(c) - a*tan(d*x)*tan(c)^2 + b*tan(d*x)*tan(c)^2 +
 a*d*x + b*d*x + a*tan(d*x) - b*tan(d*x) + a*tan(c) - b*tan(c))/(d*tan(d*x)^2*tan(c)^2 + d*tan(d*x)^2 + d*tan(
c)^2 + d)

________________________________________________________________________________________

maple [A]  time = 0.34, size = 54, normalized size = 1.64 \[ \frac {b \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+a \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(d*x+c)^2*(a+b*tan(d*x+c)^2),x)

[Out]

1/d*(b*(-1/2*cos(d*x+c)*sin(d*x+c)+1/2*d*x+1/2*c)+a*(1/2*cos(d*x+c)*sin(d*x+c)+1/2*d*x+1/2*c))

________________________________________________________________________________________

maxima [A]  time = 0.56, size = 39, normalized size = 1.18 \[ \frac {{\left (d x + c\right )} {\left (a + b\right )} + \frac {{\left (a - b\right )} \tan \left (d x + c\right )}{\tan \left (d x + c\right )^{2} + 1}}{2 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)^2*(a+b*tan(d*x+c)^2),x, algorithm="maxima")

[Out]

1/2*((d*x + c)*(a + b) + (a - b)*tan(d*x + c)/(tan(d*x + c)^2 + 1))/d

________________________________________________________________________________________

mupad [B]  time = 11.94, size = 32, normalized size = 0.97 \[ \frac {\sin \left (2\,c+2\,d\,x\right )\,\left (\frac {a}{4}-\frac {b}{4}\right )+d\,x\,\left (\frac {a}{2}+\frac {b}{2}\right )}{d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cos(c + d*x)^2*(a + b*tan(c + d*x)^2),x)

[Out]

(sin(2*c + 2*d*x)*(a/4 - b/4) + d*x*(a/2 + b/2))/d

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (a + b \tan ^{2}{\left (c + d x \right )}\right ) \cos ^{2}{\left (c + d x \right )}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cos(d*x+c)**2*(a+b*tan(d*x+c)**2),x)

[Out]

Integral((a + b*tan(c + d*x)**2)*cos(c + d*x)**2, x)

________________________________________________________________________________________